package com.yupi.ojsystem.judge.codesandbox;

import com.yupi.ojsystem.judge.codesandbox.impl.ExampleCodeSandbox;
import com.yupi.ojsystem.judge.codesandbox.impl.RemoteCodeSandbox;
import com.yupi.ojsystem.judge.codesandbox.impl.ThirdPartyCodeSandbox;
import org.springframework.beans.factory.annotation.Value;

//使用工厂模式来生成代码沙箱
public class CodeSandboxFactory {
    public static CodeSandbox newInstance(String type) {
        switch (type) {
            case "remote":
                return new RemoteCodeSandbox();
            case "example":
                return new ExampleCodeSandbox();
            case "thirdParty":
                return new ThirdPartyCodeSandbox();
            default:
                return new RemoteCodeSandbox();
        }
    }
}
